/*    */ package cc.s2m.web.s2mBlog.util;
/*    */ 
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletRequestWrapper;
/*    */ import org.apache.commons.lang3.StringEscapeUtils;
/*    */ 
/*    */ public class SafeHttpServletRequestWrapper extends HttpServletRequestWrapper
/*    */ {
/*    */   public SafeHttpServletRequestWrapper(HttpServletRequest request)
/*    */   {
/* 12 */     super(request);
/*    */   }
/*    */ 
/*    */   public String[] getParameterValues(String parameter) {
/* 16 */     String[] values = super.getParameterValues(parameter);
/* 17 */     if (values == null) {
/* 18 */       return null;
/*    */     }
/* 20 */     int count = values.length;
/* 21 */     String[] encodedValues = new String[count];
/* 22 */     for (int i = 0; i < count; i++) {
/* 23 */       if (parameter.equalsIgnoreCase("content"))
/* 24 */         encodedValues[i] = values[i];
/*    */       else {
/* 26 */         encodedValues[i] = StringEscapeUtils.escapeHtml4(values[i]);
/*    */       }
/*    */     }
/* 29 */     return encodedValues;
/*    */   }
/*    */ 
/*    */   public String getParameter(String parameter) {
/* 33 */     String value = super.getParameter(parameter);
/* 34 */     if (value == null) {
/* 35 */       return null;
/*    */     }
/* 37 */     if (parameter.equalsIgnoreCase("content")) {
/* 38 */       return value;
/*    */     }
/* 40 */     return StringEscapeUtils.escapeHtml4(value);
/*    */   }
/*    */ 
/*    */   public String getHeader(String name) {
/* 44 */     String value = super.getHeader(name);
/* 45 */     if (value == null)
/* 46 */       return null;
/* 47 */     return StringEscapeUtils.escapeHtml4(value);
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\s2mBlog.zip
 * Qualified Name:     s2mBlog-3.0.0.WEB-INF.classes.cc.s2m.web.s2mBlog.util.SafeHttpServletRequestWrapper
 * JD-Core Version:    0.6.1
 */